package com.qiyun.dinghuohui.common;

import java.util.HashMap;
import java.util.Map;

public class ClientCookie {
    private static final String USER_NAME = "__user_name__";
    private static final String PRIVILEGE = "__privilege__";
    private static String serverUrl = "http://121.42.40.79";
    public static String APP_NAME = "bibei";

    public static String getServerUrl() {
        return serverUrl;
    }

    public static void setServerUrl(String serverUrl) {
        ClientCookie.serverUrl = serverUrl;
    }

    private static Map<String, Object> store = new HashMap
            <String, Object>();

    public static void setCookie(String key, Object value) {
        store.put(key, value);
    }

    public static Object getCookie(String key) {
        return store.get(key);
    }

    public static void clean() {
        store.clear();
    }

    public static void setUsername(String username) {
        setCookie(USER_NAME, username);
    }

    public static String getUsername() {
        return (String) getCookie(USER_NAME);
    }

    public static void setPrivilege(Map<String, String> privilege) {
        setCookie(PRIVILEGE, privilege);
    }
}
